Conversation
|
✔️ All good! |
unflxw
reviewed
Mar 26, 2026
Add a new @appsignal/urql package that provides automatic GraphQL error reporting for applications using the urql GraphQL client. The package exports a createAppsignalExchange function that creates a custom urql exchange to intercept all query and mutation results and automatically report errors to AppSignal without requiring changes to individual useQuery calls. Error reports include: - GraphQL query body as a parameter - Endpoint URL as a tag - Operation name and type as tags when available This provides a seamless integration for urql users to get complete visibility into GraphQL errors in their applications.
c06a985 to
3bbbbed
Compare
This comment has been minimized.
This comment has been minimized.
tombruijn
reviewed
Mar 30, 2026
This comment has been minimized.
This comment has been minimized.
5 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This is a message from the daily scheduled checks. |
f248c71 to
418e25c
Compare
Extract `reportGraphQLError` function and test it in isolation. This allows testing Appsignal error handling logic without wiring up `urql` exchange plumbing.
418e25c to
c0fc547
Compare
tombruijn
reviewed
Apr 10, 2026
Comment on lines
+72
to
+74
| if (operation?.operationName) { | ||
| span.setTags({ operationName: operation.operationName }) | ||
| } |
Member
There was a problem hiding this comment.
This doesn't do anything in the test app. The structure of the operation value is like shown below.
So I suggest we remove it for now, as our sample tag value doesn't support partial matches at the moment. If we would collect all operation names and store them all in the same tag, you wouldn't be able to find anything for errors with more than one operation + name.
{
"operation": {
"key": 3871781863,
"query": {
"kind": "Document",
"definitions": [
{
"kind": "OperationDefinition",
"operation": "query",
"name": {
"kind": "Name",
"value": "customInvalidOperation"
},
"variableDefinitions": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "nonExistentField"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "name"
},
"arguments": [],
"directives": []
}
]
}
}
]
}
}
],
"loc": {
"start": 0,
"end": 86,
"source": {
"body": "# customInvalidOperation\nquery customInvalidOperation { nonExistentField { id name } }",
"name": "gql",
"locationOffset": {
"line": 1,
"column": 1
}
}
},
"__key": 3864687567
},
"variables": {},
"kind": "query",
"context": {
"url": "https://rickandmortyapi.com/graphql",
"preferGetMethod": false,
"requestPolicy": "cache-first",
"suspense": false
}
}
}It's not reported by urql this way so we're trying to fetch something from a field that doesn't exist. It's stored on `operation.query.definitions[#].name.value`, where `definitions` is an array. If multiple definitions can exist with their own operation names, let's not try to store them all, because our tag value filter doesn't support substring matches and if more than one operation name is supported it makes it impossible to filter by it.
tombruijn
approved these changes
Apr 10, 2026
lipskis
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on the example implementation in https://github.com/appsignal/test-setups/tree/reproduce-graphql-error-react, this patch adds a new @appsignal/urql package that provides automatic GraphQL error reporting for applications using the urql GraphQL client.
The package exports a createAppsignalExchange function that creates a custom urql exchange to intercept all query and mutation results and automatically report errors to AppSignal without requiring changes to individual useQuery calls.
This provides a seamless integration for urql users to get complete visibility into GraphQL errors in their applications.
Usage
Testing
Use the https://github.com/appsignal/test-setups/tree/reproduce-graphql-error-react branch, and hook that up to a local checkout of the repository. I haven't been able to get the test-setup to fetch from GitHub directly.